package array;

public class L69 {
    public static int mySqrt(int x) {


        int low=0;
        int high=x;
        int ans=-1;
        while (low<=high){
            int mid=(low+high)/2;
            if (mid*mid<=x){
                ans=mid;
                low=mid+1;
            }else
                high=mid-1;
        }
        return ans;

    }

    public static void main(String[] args) {
        int i = mySqrt(8);
        System.out.println(i);

    }
}
